<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../template/WorkspaceTemplate.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:define name="top">
        
    </ui:define>

    <ui:define name="left">
       
    </ui:define>

    <ui:define name="right">
       
    </ui:define>

    <ui:define name="content">
        <h:form>
            <p:panel>
                <p:messages id="msgs" showDetail="true"/>
                <p:panel header="Message Received Details">
                    <h:panelGrid columns="2">
                        <h:outputLabel value="Subject: "/>
                        <h:outputText value="#{msgManagerBean.repliedOriginalMsg.subject}"/>

                        <h:outputLabel value="Sent On: "/>
                        <h:outputText value="#{msgManagerBean.repliedOriginalMsg.formattedDate}"/>

                        <h:outputLabel value="Sent By: "/>
                        <h:outputText value="#{msgManagerBean.getSenderFullName(msgManagerBean.repliedOriginalMsg.senderAccId)}"/>

                        <h:outputLabel value="Sent To: "/>
                        <h:outputText value=""/>

                        <c:forEach items="#{msgManagerBean.repliedOriginalMsg.receiverAccIds}" var="raid" varStatus="forLoop">
                            <h:outputText value=""/>
                            <h:outputText value="#{msgManagerBean.getSelectedMsgStaffName(raid)}"/>
                        </c:forEach>
                    </h:panelGrid>
                </p:panel>
                <p:panel header="Content: ">
                    <h:outputText value="#{msgManagerBean.repliedOriginalMsg.content}"/>
                </p:panel>
                <p:commandButton value="Delete" oncomplete="dlg1.show()"/>
                <p:commandButton value="Reply" ajax="false" action="#{msgManagerBean.replyThisMsg(msgManagerBean.repliedOriginalMsg.id)}"/>
                <p:commandButton value="Reply to All" ajax="false" action="#{msgManagerBean.replyThisMsgToAll(msgManagerBean.repliedOriginalMsg.id)}"/>
                <p:commandButton value="Back To List" ajax="false" action="#{msgManagerBean.redirectToViewMsgsRcved()}"/>
                <p:commandButton value="Back" onclick="javascript: history.go(-1)"/>
            </p:panel>
            <p:confirmDialog widgetVar="dlg1" message="Are you sure to delete the selected message?"
                             showEffect="explode" hideEffect="explode"
                             header="Confirm to Delete" severity="alert">
                <p:commandButton value="Delete" onstart="dlg1.hide()" ajax="false" update="msgs"
                                 action="#{msgManagerBean.deleteCurrentRcvedOne()}"/>
                <p:commandButton value="Cancel" onclick="dlg1.hide()" type="button" />
            </p:confirmDialog>
            <p:ajaxStatus style="width: 16px;height: 16px;">
                <f:facet name="start">
                    <h:graphicImage value="./../images/ajaxloading.gif"/>
                </f:facet>
                <f:facet name="complete">
                    <h:outputText value=""/>
                </f:facet>
            </p:ajaxStatus>
        </h:form>
    </ui:define>

    <ui:define name="bottom">
       
    </ui:define>

</ui:composition>
